<?php $this->_extends('_layouts/default_layout'); ?>
 
<?php $this->_block('contents'); ?>

<span><a href="<?php echo url('telephonebook/index'); ?>" >企业电话本</a></span>
<h3>电话号码编辑</h3>
<form id="form_usersetting" name="form_usersetting" action="<?php echo url('Telephonebook/edit'); ?>" method="post" enctype="application/x-www-form-urlencoded" qform_group_id="" 
        onsubmit="
		if (this.column_title.value == '') { 
		alert('请输入部门名称'); 
		return false; }
		else { 
			if (this.column_desc.value == '') 
			{ 
				alert('请输入部门描述'); 
				return false; 
			}
			return true; 
		}"
>

  <fieldset>
    

  <p id="column_name" >
    <label for="department_title">姓名&nbsp;</label>
     <label><span class="error" name="warn_name" style="display:none" id="10014">请输入姓名</span></label>
    <input type="text"  id="10013" name="tel_name" onBlur="CheckIsNull(10013, 10014)" value="<?php echo $tel->tel_name ?>" class="textbox_short" />
  </p>


  <p id="column_desc" >
    <label for="column_desc">号码&nbsp;</label>
    
    <label><span class="error" name="warn_phone" style="display:none" id="10016">请输入号码</span></label>
    
    <input type="text"  id="10015" name="tel_num" onBlur="CheckIsNull(10015, 10016)" value="<?php echo $tel->tel_num ?>" class="textbox_short" />
  </p>

  <p id="column_desc" >
    <label for="column_desc">号码排序&nbsp;</label>
    
    <input type="num"  id="10013" name="tel_sequence" value="<?php echo $tel->tel_sequence ?>" class="textbox_short" /><span class="error">1：排在第一位，2：排在第二位，3....</span>
  </p>

  <?php if ($depsCount>0): ?>
  <p id="column_desc" >
	<tr>
		<label for="column_desc">用户部门</label>
		<select name="department_id" >
			<?php foreach ($deps as $col): ?>
				<option value="<?php echo $col->id() ?>" id="<?php echo $col->id() ?>">
					<?php echo $col->department_name; ?>
				</option>
			<?php endforeach; ?>
		</select>
	</tr>
  </p>
  <p id="column_desc" >
    <label for="column_desc">部门职务&nbsp;</label>
    
    <input type="num"  id="10013" name="tel_sequence" value="<?php echo $tel->position ?>" class="textbox_short" />
  </p>
  <p id="column_desc" >
    <label for="column_desc">客户端不可见&nbsp;</label>
    <input type="checkbox"  id="10013" name="client_visible"  />
  </p>
  <?php endif; ?>

      <input type="hidden" name="telephonebook_id" id="telephonebook_id" value="<?php echo $tel->id() ?>" />
   <p>
   <input type="submit" name="btn_submit" value="发送" class="btn" />      
   </p>

  </fieldset>
<script>
	function   LTrim(str)           //   左空格 
	{   
			var   i=0;  
			for(i=0;i <str.length;i++)   
			{   
			if(str.charAt(i)!= "   "&&str.charAt(i)!= "   ")break;
			}   
			str=str.substring(i,str.length);   
			return   str;   
	}   
	function   Trim(str)     //   两边空格 
	{   
			return   LTrim(str);   
	}  

    function CheckIsNull(check_id, des_id)
	{
        var name = document.getElementById(check_id);
		if("" == name.value || Trim(name.value)== " ")
		{				
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "";
		} 
		else
		{
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "none";
		}
	}
</script>

</form><?php $this->_endblock(); ?>
